CSharpTest.Net
InterpreterException Constructor(String,Object[])
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Commands Namespace > InterpreterException Class > InterpreterException Constructor : InterpreterException Constructor(String,Object[])

text
format

Glossary Item Box

Constructs an exception

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal text As String, _
   ByVal ParamArray format() As Object _
)
C# 
public InterpreterException( 
   string text,
   params object[] format
)

Parameters

text
format

Example

Library/Library.Test/TestCmdInterpreter.cs

C#Copy Code
InterpreterException ex = null;
try { throw new InterpreterException("TEST"); }
catch (InterpreterException e) { ex = e; }

Assert.IsNotNull(ex);
BinaryFormatter bf = new BinaryFormatter();
            
using( MemoryStream ms = new MemoryStream() )
{
    bf.Serialize(ms, ex);

    ms.Position = 0;
    ex = (InterpreterException)bf.Deserialize(ms);
    Assert.AreEqual("TEST", ex.Message);
}
VB.NETCopy Code
Dim ex As InterpreterException = Nothing
Try
    Throw New InterpreterException("TEST")
Catch e As InterpreterException
    ex = e
End Try

Assert.IsNotNull(ex)
Dim bf As New BinaryFormatter()

Using ms As New MemoryStream()
    bf.Serialize(ms, ex)

    ms.Position = 0
    ex = DirectCast(bf.Deserialize(ms), InterpreterException)
    Assert.AreEqual("TEST", ex.Message)
End Using

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys